package com.example.volunteeroa.repository;

import com.example.volunteeroa.entity.VenueAllocation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;

@Repository
public interface VenueAllocationRepository extends JpaRepository<VenueAllocation,Integer>, JpaSpecificationExecutor<VenueAllocation>{

//    @Query("select e from VenueAllocation e where e.venueID=?1")
//    List<VenueAllocation>findAllocationByVenueID(Integer venueID);
//
//    @Transactional
//    @Modifying
//    @Query(value="delete from VenueAllocation where venueID=?1",nativeQuery = true)
//    void deleteUser(Integer venueID);
//    //通过场馆ID删除需求;

    @Transactional
    @Modifying
    @Query(value="delete from VenueAllocation where venueAID=?1",nativeQuery = true)
    void deleteVenueAlloc(Integer venueAID);
}
